﻿using ALEXBlog.Entity;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace ALEXBlog.IService.Redis
{
    public interface IRedisService
    {
        Task ClearAsync();
        Task<bool> ExistAsync<TEntity>(string id) where TEntity : BaseModel;
        Task<TEntity> GetAsync<TEntity>(string id);
        Task<string> GetAsync<TEntity>(string id, string entityName);
        Task<long> RemoveAsync<TEntity>(string id) where TEntity : BaseModel;
        Task<bool> SetAsync<TEntity>(TEntity Entity, TimeSpan cacheTime) where TEntity : BaseModel;
        Task<bool> SetAsync<TEntity>(TEntity Entity) where TEntity : BaseModel;
        Task ListClearAsync(string key);
        Task<long> ListFirstPushAsync<TEntity>(string redisKey, params TEntity[] redisValue) where TEntity : BaseModel;
        Task<string> ListFirstRemoveAsync(string key);
        Task<TEntity> ListFirstRemoveAsync<TEntity>(string key) where TEntity : BaseModel;
        Task<IEnumerable<TEntity>> ListGetAsync<TEntity>(string key) where TEntity : BaseModel;
        Task<long> ListLastPushAsync<TEntity>(string redisKey, params TEntity[] redisValue) where TEntity : BaseModel;
        Task<string> ListLastRemoveAsync(string key);
        Task<TEntity> ListLastRemoveAsync<TEntity>(string key) where TEntity : BaseModel;
        Task<long> ListLengthAsync(string key);
        Task<IEnumerable<string>> ListRangeGetAsync(string key);
        Task<IEnumerable<string>> ListRangeGetAsync(string key, int startIndex, int stopIndex);
        Task<IEnumerable<TEntity>> ListRangeGetAsync<TEntity>(string key, int startIndex, int stopIndex) where TEntity : BaseModel;
        Task<long> ListRangeRemoveAsync(string key, string value, long type = 0);

    }

}
